package cn.edu.xjtu.data_structure.experiment.ex_3;

/**
 * @author yjq
 * @version 1.0
 * @date 2021/11/21 15:19
 */
public class TreeTest {
    public static void main(String[] args) {
        Treap<String, String> treap = new Treap<>();
        treap.insert("A", "ABC");
        treap.insert("C", "CAT");
        treap.insert("B", "BDR");
        treap.insert("D", "DSA");
        treap.insert("F", "FIVE");
        System.out.print("after inserting: ");
        treap.printTree(treap.getRoot());
        System.out.println();
        treap.update(treap.getRoot(), "C", "G");
        System.out.print("after updating node C: ");
        treap.printTree(treap.getRoot());
        System.out.println();
        treap.remove("B");
        System.out.print("after removing node B: ");
        treap.printTree(treap.getRoot());
        System.out.println();
        System.out.println("search node A: " + treap.search("A"));
    }
}
